package com.sky.ok.okex.websocket.client;

import java.util.Set;

import static com.sky.ok.okex.common.OKV3Const.INDEX_LIST;
import static com.sky.ok.okex.common.OkFutureConst.SWAP_BTC_K_LIST;
import static com.sky.ok.okex.common.OkFutureConst.SWAP_EOS_K_LIST;
import static com.sky.ok.okex.common.OkFutureConst.SWAP_INDEX_LIST;

/**
 * 定义WebSocket api 的订阅、取消订阅
 * @author 余心乐sky
 * @create 2019-05-20 9:47
 **/
public class WebSocketV3API {

    WebSoketClient client = WebSocketV3.getInstance();

    /*
     *
     * @Title  已订阅的数量
     * @author sky
     * @creat_date 2019/5/31 11:00
     * @return int 订阅的数量
     */
    public int SubscribeSize(){

        return client.getSubscribChannel().size();
    }

    /*
     *
     * @Title 订阅
     * @author sky
     * @creat_date 2019/5/31 10:51
     * @param    subscriptionContent   需要被订阅的字段（如K线等）
     * @return  void
     */
    public  void subscribe(String[] subscriptionContent){
        for (String sc:subscriptionContent){
            client.addChannel(sc);
        }
        System.out.println( client.getSubscribChannel().toString());
    }


    /*
     *
     * @Title 取消订阅
     * @author sky
     * @creat_date 2019/5/31 10:51
     * @param    subscriptionContent   需要被取消订阅的字段（如K线等）
     * @return  void
     */
    public  void unsubscribe(String[] unSubscriptionContent){
        for (String usc:unSubscriptionContent){
            client.removeChannel(usc);
        }
    }


    /*
     *
     * @Title  已订阅的字段
     * @author sky
     * @creat_date 2019/5/31 11:00
     * @return Set<String> 订阅的字段
     */
    public Set<String> getSubscribeName(){

        return client.getSubscribChannel();
    }


}
